<?php

include("../includes/vtemplate.class.php");


function test1()
{
  $vtemplate = new VTemplate;
  $vtphandle = $vtemplate->Open("test.vtp");
  
  if ($vtemplate->isVarExist($vtphandle, "toto"))
    $vtemplate->setVar($vtphandle, "toto", "bidule");
  
  $val = $vtemplate->Display($vtphandle, FALSE);
  
  //echo $val;
}


function test2()
{
  $myFile = "test.vtp";
  $fh = fopen($myFile, 'r');
  $theData = fread($fh, filesize($myFile));
  fclose($fh);
  
  $val = str_replace("{#toto}", "truc", $theData);
  
  //echo $val;
}


$temps_debut = microtime(true);
for ($i=0; $i<1000; $i++)
{
  test1();
}
$temps_fin = microtime(true);
echo 'Temps d\'execution : '.round($temps_fin - $temps_debut, 4);  // on affiche

$temps_debut = microtime(true);
for ($i=0; $i<1000; $i++)
{
  test2();
}
$temps_fin = microtime(true);
echo 'Temps d\'execution : '.round($temps_fin - $temps_debut, 4);  // on affiche



?> 
